package com.core.sysDict.bo;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.common.web.SelectJson;
import com.core.sysDict.dao.SysDictDao;
import com.core.sysDict.dto.SysDictDto;
import com.core.sysDict.dto.SysDictSearchCondition;
import com.core.sysDict.pojo.SysDict;
import com.util.exception.ComRuntimeException;


@Service
public class SysDictBo {
    @Resource
    private SysDictDao sysDictDao;

    public SysDict getById(SysDict sysDict) {
        return sysDictDao.getById(sysDict);
    }

    public void add(SysDict sysDict) {
        validateAddUpdate(sysDict, true);
        sysDictDao.add(sysDict);
    }

    public void update(SysDict sysDict) {
        validateAddUpdate(sysDict, false);
        sysDictDao.update(sysDict);
    }

    private void validateAddUpdate(SysDict sysDict, boolean isAdd) {
        if (sysDict == null) {
            throw new ComRuntimeException("对象不能为空");
        }

    }

    public void delete(SysDict sysDict1) {
        SysDict sysDict = getById(sysDict1);
        if (sysDict == null) {
            return;
        }
        sysDictDao.delete(sysDict1);
    }

    public List<SysDict> searchPojo(SysDictSearchCondition sc) {
        return sysDictDao.searchPojo(sc);
    }

    public List<SysDictDto> searchDto(SysDictSearchCondition sc) {
        return sysDictDao.searchDto(sc);
    }

    public Integer searchCnt(SysDictSearchCondition sc) {
        return sysDictDao.searchCnt(sc);
    }
    public List<SelectJson> search1Dto(SysDictSearchCondition sc){
    	return sysDictDao.search1Dto(sc);
    }

    //======================================= new method create here ====================================/
   
}
